package cn.pegasus.teamwork.pegasus.service.impl;

import java.util.Date;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.iyizhan.teamwork.base.service.impl.BaseServiceImpl;
import cn.iyizhan.teamwork.base.util.PageObject;
import cn.pegasus.teamwork.pegasus.entity.BussUserCars;
import cn.pegasus.teamwork.pegasus.mapper.BussUserCarsMapper;
import cn.pegasus.teamwork.pegasus.service.BussUserCarsService;

/**
 * @author ryan.bian
 * @version 
 */
@Service("bussUserCarsService")
public class BussUserCarsServiceImpl extends BaseServiceImpl<BussUserCars, BussUserCarsMapper> implements BussUserCarsService {
	// 注入当前dao对象
    @Autowired
    private BussUserCarsMapper bussUserCarsMapper;

    public BussUserCarsServiceImpl() {
        setMapperClass(BussUserCarsMapper.class, BussUserCars.class);
    }

	@Override
	public PageObject<BussUserCars> PageList(Map<String, Object> map) {
		map.put("sortName", "create_time");
        map.put("sortOrder", "desc");
		return super.Pagequery(map);
	}

	@Override
	public BussUserCars findCarInfo(Long id) {
		BussUserCars car = new BussUserCars();
		car.setId(id);
		return bussUserCarsMapper.selectSingle(car);
	}

	@Override
	public void updateCar(Long userId, BussUserCars car) {
		car.setLastUpdateTime(new Date());
		car.setLastUpdateUserId(userId);
		bussUserCarsMapper.updateByEntity(car);
	}
    
 
}
